package com.example.demopublish.controller;

import com.example.demopublish.dto.ResponseData;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.text.SimpleDateFormat;
import java.util.*;

@RestController
@RequestMapping("/test")
public class TestController {

    @PostMapping(value = "/list")
    public ResponseData test() {
        SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
        List<Map> strList = new ArrayList<>();
        for (int i = 0; i < 5; i++) {
            HashMap<String, Object> param = new HashMap<>();
            param.put("name", "name" + i);
            param.put("createTime", sdf.format(new Date()));
            strList.add(param);
        }
        return ResponseData.ok(strList);
    }


}
